package com.zhuang.memento.white_box;

/**
 * @Classname Client
 * @Description 备忘录模式 白箱 测试类
 * @Date 2021/3/29 10:15
 * @Created by dell
 */

public class Client {
    public static void main(String[] args) {
        System.out.println("--------------大战Boss前------------------------");
        //大战Boss前
        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.stateDisplay();

        //保存进度
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(gameRole.saveState());

        System.out.println("--------------大战Boss后------------------------");
        //大战Boss 损耗严重
        gameRole.fight();
        gameRole.stateDisplay();

        System.out.println("--------------满血复活------------------------");
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());
        gameRole.stateDisplay();
    }
}
